//
//  UIDevice+Extension.m
//  miku直播
//
//  Created by 杨尚达 on 2017/7/30.
//  Copyright © 2017年 杨尚达. All rights reserved.
//

#import "UIDevice+Extension.h"

@implementation UIDevice (Extension)

/**
 强制让设备进行旋转
 
 @param toOrientation 旋转目标
 */
- (void)MK_doOrientation:(UIInterfaceOrientation)toOrientation {

    if([self respondsToSelector:@selector(setOrientation:)]) {
        SEL selector = @selector(setOrientation:);
        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
        [invocation setSelector:selector];
        [invocation setTarget:self];
        [invocation setArgument:&toOrientation atIndex:2];
        [invocation invoke];
    }
}

@end
